package com.jeasonzhao.report.exceptions;

import com.jeasonzhao.report.model.Report;
import com.jeasonzhao.report.model.ReportColumn;
import com.jeasonzhao.report.msg.Message;

public abstract class DecoratorException extends ReportRuntimeException
{
    /**
     *
     */
    private static final long serialVersionUID = 1L;

    public DecoratorException(Report rpt)
    {
        super(rpt);
    }

    public DecoratorException(Report rpt,String message)
    {
        super(rpt,message);
    }

    public DecoratorException(Report rpt,Throwable cause)
    {
        super(cause,rpt);
    }

    public DecoratorException(Report rpt,String message,Throwable cause)
    {
        super(cause,rpt,message);
    }

    public DecoratorException(Object ...objs)
    {
        super(objs);
    }

    public DecoratorException(Throwable t,Object ...objs)
    {
        super(t,objs);
    }

    @Message(
        {
        "zh_cn","",
        "en",""})
    public static class SortLexError extends DecoratorException
    {
        /**
         *
         */
        private static final long serialVersionUID = 1L;

        public SortLexError(Report rpt,ReportColumn col,String script,Throwable t)
        {
            super(t,rpt,col,script);
        }
    }

    public static class SortEvalError extends DecoratorException
    {
        /**
         *
         */
        private static final long serialVersionUID = 1L;

        public SortEvalError(Report rpt,ReportColumn col,String script,Throwable t)
        {
            super(t,rpt,col,script);
        }
    }

    @Message(
        {"zh_cn","{0}配置渲染类(decorator){1}不正确，类不能转换为{2}"
        ,"en","{0} Configuration Error, can not convert the decorator class {1} to {2}"
    })
    public static class CastError extends DecoratorException
    {
        /**
         *
         */
        private static final long serialVersionUID = 1L;

        public CastError(Report item,String strClassName,Class<?> destinationClass)
        {
            super(item,strClassName
                  ,null == destinationClass ? "[Unknown destination]" : destinationClass.getName());
        }

        public CastError(Report item,String strClassName,Class<?> destinationClass,Throwable t)
        {
            super(t,item,strClassName
                  ,null == destinationClass ? "[Unknown destination]" : destinationClass.getName());
        }

    }

    @Message(
        {"zh_cn","{0}配置的渲染类(decorator){1}不存在"
        ,"en","{0} Configuration Error, can not found the decorator class {1}"
    })
    public static class ClassNotFound extends DecoratorException
    {
        /**
         *
         */
        private static final long serialVersionUID = 1L;

        public ClassNotFound(Report item,String strClassName)
        {
            super(item,strClassName);
        }

        public ClassNotFound(Report item,String strClassName,Throwable t)
        {
            super(t,item,strClassName);
        }

    }

    @Message(
        {"zh_cn","{0}:根据字典{1}展开列{2}错误，无法展开列信息"
        ,"en","{0}: Using the dictionary {1}, could not expand the column {2}"})
    public static class HorizonExpand extends DecoratorException
    {
        /**
         *
         */
        private static final long serialVersionUID = 1L;

        public HorizonExpand(Report item,ReportColumn col,Throwable t)
        {
            super(t,item,null == col ? null : col.getDictId(),col);
        }
    }
}
